<template>
  <div class="hidden-search-widget">
    <div class="input-box">
      <input
        :class="{ isOpenStatus: isOpenStatus }"
        class="input"
        placeholder="Search..."
        type="text"
      />
      <div class="box-icon" @click="openInput">
        <i class="el-icon-search"></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isOpenStatus: false,
    };
  },
  methods: {
    openInput() {
      this.isOpenStatus = !this.isOpenStatus;
    },
  },
};
</script>

<style lang="scss" scoped>
.hidden-search-widget {
  widows: 100%;
  height: 100%;
  background-color: #7a5df8;
  display: flex;
  justify-content: center;
  align-items: center;
  .input-box {
    height: 50px;
    background: #fff;
    display: flex;
    .input {
      width: 0px;
      border: 0;
      padding: 0;
      outline: none;
      transition-property: width, padding;
      transition-duration: 0.5s, 0.5s;
      font-size: 24px;
      &.isOpenStatus {
        width: 200px;
        padding: 0 20px;
      }
    }
    .box-icon {
      width: 50px;
      height: 100%;
      cursor: pointer;
      font-size: 38px;
      text-align: center;
      line-height: 50px;
    }
  }
}
</style>